<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<meta http-equiv="X-UA-Compatible" content="IE=edge" />

		<link rel="stylesheet" type="text/css" href="{{ tpldir }}/style.css" />
		<link rel="icon" type="image/png" href="{{ tpldir }}/nomail.png" />
		<title>{{ title }}</title>
	</head>

	<body>
		{% if nomenu is none %}
			<form method="post" action="{{ phpself }}">
				<div id="content">
		{% else %}
			<div>
		{% endif %}

			{% if errormsg is not none %}
				<p id="errormsg">{{ errormsg }}</p>
			{% endif %}

			{% block content %}{% endblock %}
		</div>

		{% if nomenu is none %}
				<div id="menu">
					<strong>Folders</strong>
					{% for m in menu %}
						<a href="index.php?mailbox={{ m.name }}">{{ m.prettyname|raw }}
							<span title="Total messages">{{ m.total }}</span>
							{% if m.new == 0 %}
								<span title="New messages">({{ m.new }})</span>
							{% else %}
								<em title="New messages">({{ m.new }})</em>
							{% endif %}
						</a>
					{% endfor %}
					
					<strong>Actions</strong>
					<a href="newmail.php">Write a new mail</a>

					{# Viewing a message #}
					{% if uid is not none %}
						<input type="hidden" name="uid" value="{{ uid }}" />
						<input type="hidden" name="mailbox" value="{{ mailbox }}" />

						<a href="newmail.php?mailbox={{ mailbox }}&amp;reply={{ uid }}">Reply</a>
						<a href="newmail.php?mailbox={{ mailbox }}&amp;reply={{ uid }}&amp;all=True">Reply to all</a>
						<button type="submit" name="button" value="delete" onclick="return Delete(event, '{{ autoexpunge }}')">Mark as delete</button>
						<button type="submit" name="button" value="undelete">Mark as undelete</button>
						<a href="{{ phpself }}?mailbox={{ mailbox }}&amp;uid={{ uid }}&amp;rawmessage=True">Show raw message</a>
					{% endif %}

					{# Mailbox index #}
					{% if messages is not none %}
						<button type="submit" name="button" value="read">Mark as read</button>
						<button type="submit" name="button" value="unread">Mark as unread</button>
						<button name="button" value="delete" id="deletebutton" onclick="return Delete(event, '{{ autoexpunge }}')">Mark as delete</button>
						<button type="submit" name="button" value="undelete">Mark as undelete</button>
					{% endif %}

					<div>
						<select name="newfolder">
							<option value="">Select folder</option>
							{% for m in menu %}
								<option value="{{ m.name }}">{{ m.name|raw }}</option>
							{% endfor %}
						</select><br />
						<input type="submit" name="button" value="Move" />
						<input type="submit" name="button" value="Copy" />
					</div>

					<br />

					{% if messages is not none %}
						<button type="submit" name="button" value="expunge"
							title="Removes messages marked as delete in this mailbox">Expunge</button>
						<br />
					{% endif %}

					<a href="settings.php">Settings</a>
					<a href="logout.php">Logout</a>
					
					<br />
					<hr />
					<strong><a href="http://code.google.com/p/mailview/">Mailview {{ version }}</a></strong>
				</div>
			</form>
		{% endif %}

		<script>var tpldir = '{{ tpldir }}';</script>
		<script src="{{ tpldir }}/midori.js"></script>
		<script src="{{ tpldir }}/javascript.js"></script>
		{% block afterjs %}{% endblock %}
	</body>
</html>
